package WaiBao;

import java.util.Arrays;

public class ZhangYa {
    public static void main(String[] args) {
        String[] name = {"李龙(班长)", "王波(团支书)", "小李(学习委员)", "王勃(体育委员)", "欧阳修", "张九龄", "王所欲", "张琪琪", "李金城", "旺进程", "李杨凯", "王志超",
                "宋小宝", "赵本山", "杨紫", "迪丽热巴", "杨迪", "陈美嘉", "娄艺潇", "胡一菲", "唐悠悠", "王传君", "陈赫", "陈一舟", "张伟", "张紫薇", "李浩男", "王婷婷",
                "魏征", "张雅(学生)"};//考生本人:张雅(学生)
        int[] age = {21, 22, 20, 18, 19, 22,19, 21, 20, 22, 19, 18, 23, 21, 20, 19, 18, 20, 18, 18, 19, 19, 20, 20, 20, 19,20,22,21, 20};//最后一位：考生年龄:20

        double[] peiqi1 = {91, 73, 80, 81, 75, 64, 74, 81, 80, 91, 60, 80, 84, 71, 71, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 79, 79, 80, 95};
        double[] peiqi2 = {84, 71, 64, 76, 84, 75, 80, 79, 90, 61, 91, 87, 82, 75, 66, 65, 76, 79, 64, 68, 93, 71, 90, 85, 75, 86, 75, 81, 90, 87};
        double[] peiqi3 = {71, 63, 75, 85, 76, 66, 78, 83, 80, 68, 63, 84, 85, 75, 95, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 76, 74, 82, 95};

        double lanya;//代表每个学生的总分
        double beisi;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            lanya = peiqi1[i] + peiqi2[i] + peiqi3[i];
//            beisi = ( lanya * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + lanya);
//            System.out.println(name[i] + "的平均分为:" +beisi);
//        }

        double beila = 0, jimu = 0;
        double[] cunfang = new double[30];
//        for (int i = 0; i < 30; i++) {
//            beila  =peiqi1[i] + peiqi2[i] + peiqi3[i];
//            jimu = (beila * 1.0) / 3;
//            cunfang[i] = jimu;
//        }
//
//        for (int i = 0; i < cunfang.length - 1; i++) {
//            for (int j = 0; j < cunfang.length - i - 1; j++) {
//                if (cunfang[j] < cunfang[j + 1]) {
//                    double tep = cunfang[j];
//                    cunfang[j] =cunfang[j + 1];
//                    cunfang[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(cunfang[i]);
//        }


        double dan1 = 0, dan2 = 0, dan3 = 0;//计算每门课的平均分
        double chick1 = 0,chick2 = 0,chick3 = 0;//计算每门课标准差
        double duck1 = 0, duck2 = 0, duck3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < peiqi1.length; i++) {
            sum2+=peiqi1[i];
        }
        dan1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+dan1);
        double Sum = 0;
        for (int i = 0; i < peiqi2.length; i++) {
            Sum+=peiqi2[i];
        }
        dan2 = (Sum*1.0)/30;
        System.out.println("微生物学的班级平均分为:"+dan2);
        double sum = 0;
        for (int i = 0; i <peiqi3.length; i++) {
            sum+=peiqi3[i];
        }
        dan3 = (sum*1.0)/30;
        System.out.println("人体组织解剖学的班级平均分为:"+dan3);



        double c1 = 0,c2 = 0,c3 = 0;
        for (int i = 0; i <peiqi1.length; i++) {
            c1+= (peiqi1[i] -dan1)*(peiqi1[i] -dan1);
        }
        chick1 = Math.sqrt(c1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+chick1);

        for (int i = 0; i < peiqi2.length; i++) {
            c2+= (peiqi2[i] - dan2)*(peiqi2[i] -dan2);
        }
        chick2 = Math.sqrt(c2*1.0/30);
        System.out.println("微生物学的班级标准差为:"+chick2);

        for (int i = 0; i < peiqi3.length; i++) {
            c3+= (peiqi3[i] -dan3)*(peiqi3[i] -dan3);
        }
        chick3 = Math.sqrt(c3*1.0/30);
        System.out.println("人体组织解剖学的班级标准差为:"+chick3);
////////
////////
        Arrays.sort(peiqi1);
        Arrays.sort(peiqi2);
        Arrays.sort(peiqi3);
        duck1 =( peiqi1[14]+peiqi1[15])*1.0/2;
        duck2 =( peiqi2[14]+peiqi2[15])*1.0/2;
        duck3 =( peiqi3[14]+peiqi3[15])*1.0/2;
        System.out.println("生物化学的中位数为:"+duck1);
        System.out.println("微生物学的中位数为:"+duck2);
        System.out.println("人体组织解剖学的中位数为:"+duck3);



    }
}
